package homework.api03.exercises02;

import java.sql.Array;
import java.util.ArrayList;
import java.util.Collection;

public class CollectionDemo3 {
    public static void main(String[] args) {
        Collection c = new ArrayList();
        //c.add(123);//自动装箱---c.add(Integer.valueOf(123));
        Point p = new Point(1, 2);
        c.add(p);//这里将对象p保存到集合c中,实际上保存的是p在堆中的地址
        System.out.println(p);//(1,2)
        System.out.println(c);//[(1,2)]

        p.setX(100);
        System.out.println(p);//(100,2)
        System.out.println(c);//[(100,2)]

    }
}
